<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link
	href="${pageContext.request.contextPath}/themes/bootstrap/easyui.css"
	rel="stylesheet">
<link href="${pageContext.request.contextPath}/themes/icon.css"
	rel="stylesheet">
	<script src="${pageContext.request.contextPath}/js/jquery.min.js"></script>
<script src="${pageContext.request.contextPath}/js/jquery.easyui.min.js"></script>
<script src="${pageContext.request.contextPath}/js/easyui-lang-zh_CN.js"></script>
	<script type="text/javascript" src="${pageContext.request.contextPath}/bootstrap/js/jquery-1.7.2.js"></script>
<title>Insert title here</title>
</head>
<body>
	<div>
		<a href="${pageContext.request.contextPath}/selectSellerorderid">查询订单相关信息</a>
		<form action="submit" method="post">
			<h3>过往订单</h3>
			<table>
				<tr>
					<td>订单索引</td>
					<td></td>
					<td>菜品名</td>
					<td></td>
					<td>菜品价格</td>
					<td></td>
					<td>菜品数目</td>
					
				</tr>
				<c:forEach items="${foodss0}" var = "foods0" varStatus="carfs0">
					<tr><td>${carfs0.index+1}</td></tr>
					<c:forEach items="${foodss0.get(foodss0.indexOf(foods0))}" var = "food0" varStatus="carf0">
				    	<tr>
							<td>${carf0.index+1}</td>
							<td></td>
							<td>${food0.foodname}</td>
							<td></td>
							<td>${food0.foodprice}</td>
							<td></td>
							<td><p>*${scars0.get(carfs0.index).get(carf0.index)}</p></td>
				    	</tr>
			    	</c:forEach>
			    	<td style="margin-right: 100px;">
				     				总价： ￥<c:out value="${orderprice0.get(foodss0.indexOf(foods0))}"></c:out>元
				     			</td>
				</c:forEach>
			</table>
			
			<h3>已接单订单</h3>
			<table>
				<tr>
					<td>订单索引</td>
					<td></td>
					<td>菜品名</td>
					<td></td>
					<td>菜品价格</td>
					<td></td>
					<td>菜品数目</td>
					
				</tr>
				<c:forEach items="${foodss1}" var = "foods1" varStatus="carfs1">
					<tr><td>${carfs1.index+1}</td></tr>
					<c:forEach items="${foodss1.get(foodss1.indexOf(foods1))}" var = "food1" varStatus="carf1">
				    	<tr>
				    		<td>${carf1.index+1}</td>
				    		<td></td>
							<td>${food1.foodname}</td>
							<td></td>
							<td>${food1.foodprice}</td>
							<td><p>*${scars1.get(carfs1.index).get(carf1.index)}</p></td>
							<td>
							</td>
				    	</tr>
			    	</c:forEach>
				</c:forEach>
			</table>
			
			<h3>未接单订单</h3>
			<table>
				<tr>
					<td>订单索引</td>
					<td></td>
					<td>菜品名</td>
					<td></td>
					<td>菜品价格</td>
					<td></td>
					<td>菜品数目</td>
					
				</tr>
				<c:forEach items="${foodss2}" var = "foods2" varStatus="carfs2">
					<tr><td class = "a">${carfs2.index+1}</td></tr>
			    	<c:forEach items="${foodss2.get(foodss2.indexOf(foods2))}" var="food2"  varStatus="carf2">
				    	<tr>
							<td>${carf2.index+1}</td>
							<td></td>
							<td>${food2.foodname}</td>
							<td></td>
							<td>${food2.foodprice}</td>
							<td></td>
							<td><p>*${scars2.get(carfs2.index).get(carf2.index)}</p></td>
				    	</tr>
			    	</c:forEach>
			    	<tr><td><input type="button" class="btn btn-warning" name = "orders" value="确认接单"/></td></tr>
				</c:forEach>
			</table>

		</form>
	</div>
	
</body>
<script type="text/javascript">
	$(function(){
		//商家确认接单
		$("input[name = 'orders']").each(function(){
			$(this).click(function(){
				var $class = $("input[name = 'orders']");
				var index = $class.index($(this));
				var number = $('.a').eq(index).html();
				$.ajax({
					type:'post',
					url:'${pageContext.request.contextPath}/orders',
					data:{
						'number':number,
					},
					success:function(data){
						location.href = '${pageContext.request.contextPath}/selectSellerorderid';						
					}
				})
			})
		});
	});
</script>
</html>